package com.example.demoserver.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.demoserver.entity.TrainQuestions;
import com.example.demoserver.entity.TrainUserquesions;
import com.example.demoserver.service.TrainUserquesionsService;
import com.example.demoserver.mapper.TrainUserquesionsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author 18364
* @description 针对表【train_userquesions】的数据库操作Service实现
* @createDate 2024-11-05 10:24:26
*/
@Service
public class TrainUserquesionsServiceImpl extends ServiceImpl<TrainUserquesionsMapper, TrainUserquesions>
    implements TrainUserquesionsService{
    @Autowired
    TrainUserquesionsMapper trainUserquesionsMapper;

    @Override
    public TrainUserquesions select() {

        return trainUserquesionsMapper.selectOne(null);
    }

    @Override
    public TrainUserquesions selectByUserId(Integer userId) {
        QueryWrapper<TrainUserquesions> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("userId",userId);
        return trainUserquesionsMapper.selectOne(queryWrapper);
    }

    @Override
    public Integer deleteAll() {
        QueryWrapper<TrainUserquesions> queryWrapper=new QueryWrapper<>();

        return trainUserquesionsMapper.delete(queryWrapper);
    }
}




